package com.sqx.modules.riderLine.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.riderLine.entity.RiderLine;
import com.sqx.modules.riderLine.service.RiderLineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

/**
 * 骑手在线时长-管理端
 * @author wuChang
 * @since 2024-05-20
 */
@RestController
@Api(value = "骑手在线时长-管理端", tags = {"骑手在线时长-管理端"})
@RequestMapping("/admin/riderLine/")
public class RiderLineController {
    @Autowired
    private RiderLineService riderLineService;

    /**
     * 获取骑手在线时长列表
     * @param riderLine 骑手在线时长
     */
    @ApiOperation("获取骑手在线时长列表")
    @GetMapping(value = "getRiderLineList")
    public Result getRiderLineList(Integer page, Integer limit, RiderLine riderLine) {

        return Result.success().put("data", riderLineService.getRiderLineList(page, limit, riderLine));
    }

    /**
     * 删除骑手在线时长
     *@param lineId 骑手在线时长id
     */
    @ApiOperation("删除骑手在线时长")
    @PostMapping(value = "deleteRiderLineById")
    public Result deleteRiderLineById(Long lineId) {

        return riderLineService.removeById(lineId) ? Result.success() : Result.error();
    }


    /**
     * 获取骑手在线时长详情
     *@param lineId 骑手在线时长id
     */
    @ApiOperation("获取骑手在线时长详情")
    @GetMapping(value = "getRiderLineById")
    public Result getRiderLineById(Long lineId) {
        return Result.success().put("data", riderLineService.getById(lineId));
    }

}